package com.hbsc.service;

//import com.hbsc.mapper.YqtestDemoMapper;
import com.hbsc.domain.RegisterVo;
import com.hbsc.mapper.YqtestDemoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * Created by xvdong on 2017-10-17.
 */
@Component
@Transactional
public class YqTestService {

    @Autowired
     private YqtestDemoMapper mapper;

    public String test() {
        return "测试dubbo";
    }

  /*  public List<Map> test2(String sql) {
        return mapper.query(sql);
    }*/

    public List weiXinList(){
        return mapper.weiXinList();
    }

    /**
     * 获取已使用的校验码
     */
    public List queryCheckCodeList(){
        List list = mapper.queryCheckCodeList();
        return list;
    }

    public void savePayRecodeInfo(String validateCode,String registerId){
        Long count = mapper.queryPayRecodeInfoCount(registerId);
        if(count != null && count>0){
            mapper.deletePayRecodeInfo(registerId);
        }
        mapper.savePayRecodeInfo(validateCode,registerId);
    }

    public Long queryPayRecodeInfoCount(String openid){
       return mapper.queryPayRecodeInfoCount(openid);
    }

    public RegisterVo queryPayRecodeInfo(String openid){
        return mapper.queryPayRecodeInfo(openid);
    }
}
